<template>
  <page-meta :page-style="`overflow:${openDrawer ? 'hidden' : 'visible'};`"></page-meta>
  <ServiceFormRecord
    :record-type="recordType"
    :api="appFillinRecordList"
    @click="handleClick"
    @edit="handleEdit"
  ></ServiceFormRecord>
</template>

<script lang="ts" setup>
  /* appServiceFormRecord 服务表单记录 */
  import ServiceFormRecord from '../components/ServiceFormRecord/index.vue';
  import { provide, ref } from 'vue';
  import { appFillinRecordList } from '@/api/serviceForm';
  import type { IFormFillRecordList } from '@/api/serviceForm/types';
  import { navigateTo } from '@/router';
  import { onPageScroll } from '@dcloudio/uni-app';
  const recordType = ref(0);
  const openDrawer = ref<boolean>(false);

  provide('openDrawer', openDrawer);
  const handleClick = (item: IFormFillRecordList) => {
    navigateTo({
      name: 'appServiceFormRecordDetail',
      options: {
        id: item.id,
      },
    });
  };

  onPageScroll(() => {});

  const handleEdit = (item: IFormFillRecordList) => {
    navigateTo({
      name: 'serviceFormFilling',
      options: {
        serviceTicketRecordId: item.id,
        serviceTicketFormId: item.serviceTicketFormId,
      },
    });
  };
</script>

<style lang="scss" scoped></style>
